<?php

/**
 * @Author: zhibinm (113664000@qq.com)
 * @Date:   2018-04-19 11:13:33 
 * @Copyright:   xuebingsi
 * @Last Modified by:   Zhibinm
 * @Last Modified time: 2018-04-20 08:25:19
 */
include './common.php';

$data = $_POST;

var_dump($data);

$userList = getData('./db/user.txt');

var_dump($userList);


foreach ($userList as  $user) {
	if($user['username']==$data['username']&&$user['password']==md5($data['password'])){

		$_SESSION['username'] = $user['username'];

		setcookie(session_name(),session_id(),time()+86400,'/');

		notice('./index.php',"登录成功");
		exit;
	}
}

notice('./login.php',"用户名或者密码不正确",false,2);